package cn.edu.leetcode.算数;

public class x的平方根 {

    public static int mySqrt(int x) {
        for (int i = 0; i <= x; i++) {
            long n = (long) i;
            n *= i;
            if (n > x) return i - 1;
        }
        return x;
    }

    public static void main(String[] args) {
        System.out.println(mySqrt(4));
    }
}
